exports.register = function(req,res){

    var bodyParams = req.routeInfo.bodyParams;

    //查看该帐号是否已被注册
    function usernameIsUsed(cb){

        R.SEND_HTTP(
            req,
            res,
            {
                url    : CORE_APIConfig.coreAPI.userSearch.Request_Api_Url + "/u_username/" + bodyParams.username,  
                method : 'POST',                    
                data   : {
                    fields : "u_id"
                }
            },
            function (data) {

                if(data.result.data.length > 0){
                    return RES.errorResponse(res,"该帐号已存在，请重新输入");
                }

                cb();

            }
        )
    }

    //注册用户
    function userRegister(cb){

        R.SEND_HTTP(
            req,
            res,
            {
                url    : CORE_APIConfig.coreAPI.userAdd.Request_Api_Url,  
                method : 'POST',                    
                data   : {
                    u_username      : bodyParams.username,
                    u_password      : bodyParams.password,
                    u_phone         : bodyParams.username,
                    u_is_activation : 1,
                    u_nickname      : bodyParams.username,
                    u_create_time   : common.nowTime(false)
                }
            },
            function (data) {

                cb();

            }
        )

    }

    F.Serial([
        usernameIsUsed,
        userRegister
    ],() => {

        //将最终结果返回给客户端
        RES.successResponse(res);
    
    })

}